from django.db import models


class LeaveRequest(models.Model):
    student_name = models.CharField(max_length=100)
    teacher_name = models.CharField(max_length=100)
    student_id = models.CharField(max_length=20)
    level = models.CharField(max_length=50)
    level_2 = models.CharField(max_length=50)
    major = models.CharField(max_length=100)
    if_or_school = models.BooleanField()
    if_or_city = models.BooleanField()
    leave_request_type = models.CharField(max_length=50)
    phone_num = models.CharField(max_length=15)
    start_time = models.DateTimeField()
    end_time = models.DateTimeField()
    text_1 = models.TextField()  # 原字段名 txt_，已重命名
    text_2 = models.TextField(blank=True, null=True)  # 原字段名 txt_2，已重命名
    time_1 = models.DateTimeField(blank=True, null=True)
    time_2 = models.DateTimeField(blank=True, null=True)

    def __str__(self):
        return f"{self.student_name} - {self.leave_request_type}"

    class Meta:
        verbose_name = "请假列表"
        verbose_name_plural = verbose_name
